package cn.ht.jywrwater.module.ht.dal.mysql.waterqualityalertcount;

import java.util.*;

import cn.ht.jywrwater.framework.common.pojo.PageResult;
import cn.ht.jywrwater.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.ht.jywrwater.framework.mybatis.core.mapper.BaseMapperX;
import cn.ht.jywrwater.module.ht.dal.dataobject.waterqualityalertcount.WaterQualityAlertCountDO;
import org.apache.ibatis.annotations.Mapper;
import cn.ht.jywrwater.module.ht.controller.admin.waterqualityalertcount.vo.*;

/**
 * 水质统计 Mapper
 *
 * @author hzx
 */
@Mapper
public interface WaterQualityAlertCountMapper extends BaseMapperX<WaterQualityAlertCountDO> {

    default PageResult<WaterQualityAlertCountDO> selectPage(WaterQualityAlertCountPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<WaterQualityAlertCountDO>()
                .eqIfPresent(WaterQualityAlertCountDO::getWaterType, reqVO.getWaterType())
                .eqIfPresent(WaterQualityAlertCountDO::getAlertType, reqVO.getAlertType())
                .eqIfPresent(WaterQualityAlertCountDO::getYearValue, reqVO.getYearValue())
                .eqIfPresent(WaterQualityAlertCountDO::getMonthValue, reqVO.getMonthValue())
                .betweenIfPresent(WaterQualityAlertCountDO::getDataDate, reqVO.getDataDate())
                .eqIfPresent(WaterQualityAlertCountDO::getAlertCount, reqVO.getAlertCount())
                .betweenIfPresent(WaterQualityAlertCountDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(WaterQualityAlertCountDO::getId));
    }

    default List<WaterQualityAlertCountDO> selectList(WaterQualityAlertCountExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<WaterQualityAlertCountDO>()
                .eqIfPresent(WaterQualityAlertCountDO::getWaterType, reqVO.getWaterType())
                .eqIfPresent(WaterQualityAlertCountDO::getAlertType, reqVO.getAlertType())
                .eqIfPresent(WaterQualityAlertCountDO::getYearValue, reqVO.getYearValue())
                .eqIfPresent(WaterQualityAlertCountDO::getMonthValue, reqVO.getMonthValue())
                .betweenIfPresent(WaterQualityAlertCountDO::getDataDate, reqVO.getDataDate())
                .eqIfPresent(WaterQualityAlertCountDO::getAlertCount, reqVO.getAlertCount())
                .betweenIfPresent(WaterQualityAlertCountDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(WaterQualityAlertCountDO::getId));
    }

}
